<?php
include_once("codelibrary/inc/variables.php");
include_once("session.php");
include_once("codelibrary/inc/functions.php");

$parent = $_SESSION['business_id'];
$getParentData = getAnyTableWhereData($business_info_table," and business_id='$parent'");

if(isset($_REQUEST['Submit']))
{
    $businesscategory = $getParentData['businesscategory'];
    $companyname=$TR_Company;
	$locationname=$TR_Location;   
	$firstname=$TRFN_FirstName;
	$lastname=$TRFN_LastName;
	$email=$TREF_Email;
	$address=$TR_Address;
	$city=$TR_City;
	$state=$TR_State; 
	$zipcode=$TR_Zip;
	$country=$TR_Country;
	$timezone=$TR_TimeZone;
	$phonenumber=$PHR_Phone;
	$altphonenumber=$PHN_AltPhone;
	$faxnumber=$TN_Fax;
	$directions=$TN_Directions;
	$webaddress=$TN_WebAddress;
	////Not Valid for headquarters,valid only for locations set up under a particular main HeadQuarters of the Company
	$optionsettings=$TN_OptionSettings;  
	$emailsettings=$TN_MailSettings; 
	
	
	$insert_sql="insert into business_info set businesscategory='$businesscategory' , companyname='$companyname' , locationname='$locationname' , parent='$parent' , firstname='$firstname' , lastname='$lastname' , email='$email' , address='$address' , city='$city' , state='$state' , zipcode='$zipcode' , country='$country' , timezone='$tinezone' , phonenumber='$phonenumber' , faxnumber='$faxnumber' , webaddress='$webaddress' , directions='$directions', optionsettings='$optionsettings' , emailsettings='$emailsettings' ";
	mysql_query($insert_sql);
	header("Location: location-view-details.php?msg=Added");
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="LTR" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Online Appointment</title>
<script type="text/javascript" src="codelibrary/js/common.Js"></script>
<script type="text/javascript">
function submitform()
{
 
	if(ValidateForm(document.frm))
	{
	    return true;
	}
	else
	{
	    return false;
	}
}
</script>

<base >
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>Staff Management</title>

</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">


<table cellpadding="0" cellspacing="0" border="0"><tr>
  <td style="background:url(images/top.gif) repeat-x top; ">
<table cellpadding="0" cellspacing="0" border="0" style="width:764px" align="center"> 
	<tr>
		<td>
			<img border="0" src="images/logo.jpg" width="208" height="86">
			<table cellpadding="0" cellspacing="0" border="0" style="height:57">
				<tr>
					<td height="57">
<? html_header(); ?>					</td>
				</tr>
			</table>


		</td>
	</tr>
	<tr>
		<td>





<table border="0" width="105%" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top" class="col_left">

<table border="0"cellspacing="0" cellpadding="0" class="box_width_left">
	<tr><td width="100%">
		<table border="0" cellspacing="0" cellpadding="0">
<tr><td>

<table border="0" width="100%" cellspacing="0" cellpadding="0" class="">
  <tr>
    <td>
    <table border="0" width="100%" cellspacing="0" cellpadding="0"  class="" height="91">
  <tr>
    <td align="center" height="91">&nbsp;    </td>
  </tr>
</table>
</td>
  </tr>
</table>
</td></tr>


          <tr>
            <td>
<table border="0" width="100%" cellspacing="0" cellpadding="0"  class="box_header_txt" height="48">
  <tr>
    <td style="background-image: url(images/1_bg2-2.gif)" height="1">
      <p style="margin-top: 16"> </td>
  </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0"   style="border-bottom:12px solid #ffffff;">
  <tr>
    <td>
    <table border="0" width="100%" cellspacing="0" cellpadding="0"  style="margin-bottom:0px;background:#7C7C7C url(images/1_line.gif) no-repeat left bottom;" >
  <tr>
    <td  style="padding:3px 16px 8px 25px;">
<? include("link1.php");?>    </td>
  </tr>
</table>
</td>
  </tr>
</table>
            </td>
          </tr>


          <tr>
            <td class="">&nbsp;
</td>
          </tr>

		</table>
	</td>
	<td><img src="images/spacer.gif" border="0" alt="" width="15" height="1"></td></tr>
</table>

    </td>

    <td width="100%" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="0"  class="cont_header_txt">
  <tr>
    <td>
			<table border="0" cellpadding="0" cellspacing="0" bgcolor="#EAEAEA" class="cont_header_txt">
				<tr>
					<td><img src="images/1_q1.gif" border="0" alt="" width="45" height="39"></td>
					<td style="width:100%">Add new location </td>
					<td><img src="images/1_q2.gif" border="0" alt="" width="10" height="39"></td>
				</tr>
			</table>										 
			</td>
  </tr>
</table>


						
						<table cellpadding="0" cellspacing="0" border="0" style="border:0px solid #DEDEDE; border-width:0px 1px 0px 1px;">
                          <tr>
                            <td style="background:#ffffff;border:0px solid #ffffff; border-width:18px 5px 10px 5px;"><!-- new_products //-->
                                <table border="0" width="" cellspacing="0" cellpadding="0" >
                                  <tr>
                                    <td><form name="frm" action="" method="post" onSubmit="return submitform();">
                                <table width="108%" border="1" cellpadding="3" cellspacing="2" bordercolor="#FFDBCA" class="table">
                                  <tr>
                                    <td width="29%" height="27" valign="bottom" class="simpletxt">&nbsp;Company Name </td>
                                    <td height="27" colspan="2" valign="top" nowrap class="smallText"><label>
                                      <input name="TR_Company" type="text" value="<? if(isset($TR_Company)) echo $TR_Company;?>" size="30">
                                      </label></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Location Name </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><input name="TR_Location" type="text" value="<? if(isset($TR_Location)) echo $TR_Location;?>" size="30"></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Address </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><textarea name="TR_Address" rows="3" cols="3"><? if(isset($TR_Address))echo $TR_Address;?>
</textarea></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;City </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><INPUT name="TR_City"  type="TEXT" value="<? if(isset($TR_City))echo $TR_City;?>" size="30"></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;State </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><INPUT name="TR_State"  type="TEXT"  value="<? if(isset($TR_State))echo $TR_State;?>" size="30"></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Zip Code </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><INPUT name="TR_Zip"  type="TEXT" value="<? if(isset($TR_Zip))echo $TR_Zip;?>" size="30"></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Country </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><SELECT name="TR_Country">
                                        <?php

									foreach($ar_country_WI as $key=>$value)
									{
									  
								?>
                                        <OPTION <? if($key!=0){ ?> value="<?=$value;?>" <? } ?> <? if(isset($TR_Country) && $TR_Country==$value){echo "selected";}?>>
                                        <?=$value;?>
                                        </OPTION>
                                        <?php
									}
							   ?>
                                      </SELECT>                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Phone Number </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><INPUT name="PHR_Phone" type="TEXT" value="<? if(isset($PHR_Phone))echo $PHR_Phone;?>" size="30">                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Alternate Phone Number </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><INPUT name="PHN_AltPhone" type="TEXT" value="<? if(isset($PHN_AltPhone))echo $PHN_AltPhone;?>" size="30">                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Fax Number </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><input name="TN_Fax" type="text" id="TN_Fax" value="<? if(isset($TN_Fax))echo $TN_Fax;?>" size="30">                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Contact First Name </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><INPUT name="TRFN_FirstName"  type="TEXT" value="<? if(isset($TRFN_FirstName))echo $TRFN_FirstName;?>" size="30">                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Contact Last Name </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><INPUT name="TRFN_LastName" type="TEXT" value="<? if(isset($TRFN_LastName))echo $TRFN_LastName;?>" size="30">                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Contact E-mail Address </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><INPUT name="TREF_Email" type="TEXT" value="<? if(isset($TREF_Email))echo $TREF_Email;?>" size="30">                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Web Address </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><input name="TN_WebAddress" type="text" id="TN_WebAddress" value="<? if(isset($TN_WebAddress))echo $TN_WebAddress;?>" size="30">                                    </td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" nowrap="nowrap" class="simpletxt">&nbsp;Use Headquarter Values </td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><label>
                                      <input name="TN_OptionSettings" type="radio" value="1"
								<? 
								if(!isset($TN_OptionSettings))
								{
								   echo "checked";
								}
								if(isset($TN_OptionSettings) && $TN_OptionSettings=="yes"){ echo "checked";}?> >
                                      Yes
                                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                      <input name="TN_OptionSettings" type="radio" value="0" 
								<? if(isset($TN_OptionSettings) && $TN_OptionSettings=="no"){ echo "checked";}?> >
                                      N
                                      o </label>
                                      <p align="justify">A &quot;Yes&quot; selection means that the location will share the preferences, services and other items that have been setup for the headquarters location. </p></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" nowrap="nowrap" class="simpletxt">&nbsp;Separate Emails? <br>
                                      <p align="justify">&nbsp;</p></td>
                                    <td height="27" colspan="2" valign="bottom" class="simpletxt"><label>
                                      <input name="TN_MailSettings" type="radio" value="1"
								<? 
								
								if(isset($TN_MailSettings) && $TN_MailSettings=="yes"){ echo "checked";}?> >
                                      yes
                                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                      <input name="TN_MailSettings" type="radio" value="0" 
									  
								<? 
								if(!isset($TN_MailSettings))
								{
								   echo "checked";
								}
								if(isset($TN_MailSettings) && $TN_MailSettings=="no"){ echo "checked";}?> >
                                      no <br>
                                    </label>
                                      <div align="justify">A &quot;Yes&quot; selection means that the location will have its ownset of emails that get sent to customers and to internal staff. a &quot;no&quot; selection means that the location shares the emails from the headquarters. </div></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Directions </td>
                                    <td height="27" colspan="2" valign="bottom" class="smallText"><textarea name="TN_Directions" rows="3" cols="40"><? if(isset($TN_Directions))echo $TN_Directions;?>
</textarea></td>
                                  </tr>
                                  <tr>
                                    <td height="27" valign="bottom" class="simpletxt">&nbsp;Time Zone </td>
                                    <td height="27" colspan="2" valign="bottom" nowrap class="smallText"><label>
                                      <SELECT name="TR_TimeZone">
									  <option value="" selected="selected">--- Select Time Zone ---</option>
                                        <?php

									foreach($array_time_zone_WI as $key=>$value)
																{
																  
																?>
                                        <OPTION <? if($key!=0){ ?> value="<?=$value;?>" <? } ?> <? if(isset($TR_TimeZone) && $TR_TimeZone==$value){echo "selected";}?>>
                                        <?=$value;?>
                                        </OPTION>
                                        <?php
																}
																?>
                                      </SELECT>
                                      </label></td>
                                  </tr>
                                  <tr>
                                    <td colspan="3" align="center" valign="middle" class="smallText"><input name="Submit" type="submit" class="button" value="  Add  " />
                                      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;
                                      <input name="reset" type="reset" class="button" value="  Reset  " />                                    </td>
                                  </tr>
                                </table>
                              </form></td>
                                  </tr>
                                </table>
                              <table border="0" cellspacing="0" cellpadding="0" align="center">
                                  <tr>
                                    <td></td>
                                  </tr>
                              </table></td>
                          </tr>
                        </table>
						
						<table cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td><img src="images/1_q4.gif" border="0" alt="" width="10" height="10"></td>
								<td style="width:100%; background-image:url(images/1_li1.gif)"></td>
								<td><img src="images/1_q3.gif" border="0" alt="" width="10" height="10"></td>
							</tr>
						</table>
						


		
		
		</td>

    <td class="col_right">

<table border="0"cellspacing="0" cellpadding="0" class="box_width_right">
	<tr><td></td>
		<td width="100%">
			<table border="0" cellspacing="0" cellpadding="0">
				<tr><td></td></tr>
			</table>
		</td>
	</tr>
</table>


    </td>
  </tr>
</table>



		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" style="height:98px; background-image:url(images/bot.gif)">
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" border="0" class="footer">
							<tr>									
								<td height="77"><img src="images/spacer.gif" border="0" alt="" width="25" height="1"></td>				
								<td style="width:207px"><br style="line-height:49px"><img src="images/p1.gif" border="0" alt="" width="145" height="24"><br></td>
							  <td style="width:532px">&nbsp;</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table></td></tr></table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"></td>
  </tr>
</table>
</body>

</html>